package zuoye2;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Test5 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        System.out.println("请输入随机的字符串");
        String s = sc.next();
        ArrayList<String> list = new ArrayList<>();
        for (int i = 0; i < s.length(); i++) {
            list.add(String.valueOf(s.charAt(i)));
        }

        Map<String,Integer> map = new HashMap<>();

        for (String s1 : list) {
           if (map.containsKey(s1)){
               map.put(s1,map.get(s1)+1);
           }else {
               map.put(s1,1);
           }


        }
        map.forEach((k,v)-> System.out.print(k+v));



    }
}
